<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="format-detection" content="telephone=no" />
    <title>业务管理系统-权限管理-角色管理</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link rel="stylesheet" href="/css/style.css" />
    <link rel="stylesheet" href="/css/iconfont.css" />
    <link rel="stylesheet" href="/css/element-icons.css" />
    <link rel="stylesheet" href="/css/newiconfont.css" />
    <script src="/js/jquery.min.js"></script>
    <script src="/js/lib.js"></script>
    <!--[if lt IE 9]>
        <script src="https://cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
        <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!--[if IE]>
        <link rel="stylesheet" href="/css/all-ie-only.css" />
    <![endif]-->
</head>

<body>
    <div class="header">
        <a href="javascript:;" class="header-logo">
            <img src="/images/logo.png" alt="" />
        </a>
        <div class="header-nav">
            <ul class="fix">
                <li>
                    <a href="javascript:;" class="v1">标识注册系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">标识解析系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">统一认证系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">运行检测系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">区块链浏览器</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">链网展示系统</a>
                </li>
            </ul>
        </div>
        <div class="header-user">
            <a href="javascript:;" class="hd">
                <img src="/images/head.png" alt="" />
                <span>管理员</span>
            </a>
            <div class="dropdown-menu">
                <div class="icon-arrow"></div>
                <ul>
                    <li class="wrz">
                        <a href="javascript:;" class="con">
                            <span>未认证</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="con">
                            <span>首页</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="con">
                            <span>资料编辑</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="con">
                            <span>我的钱包</span>
                        </a>
                    </li>
                    <li>
                       <a onclick="logout()" class="con">
                            <span>退出</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="block-contail">
        <!-- 布局-侧边 -->
        <div class="block-left">
            <div class="block-scrollbar">
                <!-- 收起、展开按钮 -->
                <div class="arrow-btn">
                    <span class="el-icon-arrow-left"></span>
                </div>
                <!-- 收起、展开按钮 end -->
                <!-- 侧边导航 -->
                <ul class="slide-nav">
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon1-guganlianguanli"></i>
                            <span class="title">骨干链管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">基础配置</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">节点管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">合约管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">用户管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon2-zilianguanli"></i>
                            <span class="title">子链管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链申报管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链区块头</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链节点管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链用户管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链合约管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon3-renzhengzhongxin"></i>
                            <span class="title">认证中心</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="/manage/authentication/certificateperson.html" class="v2">
                                        <span class="title">个人认证</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/manage/authentication/certificatecorp.html" class="v2">
                                        <span class="title">企业认证</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/manage/authentication/certificatenode.html" class="v2">
                                        <span class="title">节点认证</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon6-quanxianguanli"></i>
                            <span class="title">权限管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">角色管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon iconfont iconicon_setting"></i>
                            <span class="title">系统管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="/manage/system/user.html" class="v2">
                                        <span class="title">用户管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/manage/system/dictbiz.html" class="v2">
                                        <span class="title">系统字典</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/manage/system/dictbiz.html" class="v2">
                                        <span class="title">业务字典</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/manage/system/menu.html" class="v2">
                                        <span class="title">菜单管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                </ul>
                <!-- 侧边导航 end -->
            </div>
        </div>
        <!-- 布局-侧边 end -->
        <!-- 布局-主内容 -->
        <div class="block-main">
            <div class="block-scrollbar">
                <!-- 主内容 -->
                <div class="block-2">
                    <div class="block2-cont">
                        <div class="box-set5">
                            <div class="set-bd2">
                                <div class="set-item col-3">
                                    <div class="tit">角色名称:</div>
                                    <div class="con">
                                        <input id="role" type="text" class="input-inner" placeholder="角色名称" />
                                    </div>
                                </div>
                                <div class="set-item col-3">
                                    <div class="tit">所属租户:</div>
                                    <div class="con">
                                        <div class="dropmenurel01 js-dropmenu" data-modulename="dropmenurel01">
                                            <input type="hidden" value="" id="tenantId">
                                            <div class="dropmenurel01-tit">
                                                <span id="tenantName">所属租户</span>
                                                <i class="el-input__icon el-icon-arrow-up"></i>
                                            </div>
                                            <div class="dropmenurel01-options js-dropmenu-options">
                                                <i class="popper__arrow"></i>
                                                <ul id="select">
                                                    <div class="input">
                                                        <input type="text" class="input-inner"
                                                            placeholder="输入关键字进行过滤" />
                                                    </div>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="set-item col-3">
                                    <div class="tit">角色别名:</div>
                                    <div class="con">
                                        <input id="roleAlias" type="text" class="input-inner" placeholder="角色别名" />
                                    </div>
                                </div>
                            </div>
                            <div class="set-bt set-bt_r">
                                <a href="javascript:;" class="primary-btn" id="search">
                                    <i class="icon_dn el-icon-search"></i>
                                    <span>搜索</span>
                                </a>
                                <a href="javascript:;" id="reset">
                                    <i class="icon_dn el-icon-delete"></i>
                                    <span>清空</span>
                                </a>
                            </div>
                        </div>
                        <div class="box-set6">
                            <div class="set-bt3">
                                <div id="refresh" class="item">
                                    <a href="javascript:;" class="btn">
                                        <i class="el-icon-refresh"></i>
                                    </a>
                                    <div class="mask">
                                        <div class="popper__arrow"></div>
                                        <div class="tit">刷新</div>
                                    </div>
                                </div>
                                <div class="item myfancy" data-href="#pop-xianyin">
                                    <a href="javascript:;" class="btn">
                                        <i class="el-icon-s-operation"></i>
                                    </a>
                                    <div class="mask">
                                        <div class="popper__arrow"></div>
                                        <div class="tit">显隐</div>
                                    </div>
                                </div>
                                <div class="item js_search_show_hide">
                                    <a href="javascript:;" class="btn">
                                        <i class="el-icon-search"></i>
                                    </a>
                                    <div class="mask">
                                        <div class="popper__arrow"></div>
                                        <div class="tit">搜索</div>
                                    </div>
                                </div>
                            </div>
                            <div class="set-bt">
                                <a href="javascript:;" class="primary-btn myfancy" data-href="#pop-juesexinzeng">
                                    <i class="icon_dn el-icon-plus"></i>
                                    <span>新 增</span>
                                </a>
                                <a id="batch_delete" href="javascript:;" class="del-btn myfancy" data-href="#pop-shanchu3">
                                    <i class="icon_dn el-icon-delete"></i>
                                    <span>删 除</span>
                                </a>
                                <a id="permission_set" href="javascript:;" >
                                    <i class="icon_dn el-icon-setting"></i>
                                    <span>权限设置</span>
                                </a>
                            </div>
                        </div>
                        <div class="data-content_2 table-scroll-x js-custom-radio-checkbox" data-modulename="formrel01">
                            <div class="table1-head table-6">
                                <table>
                                    <colgroup>
                                        <col width="50">
                                        <col width="50">
                                        <col width="NaN">
                                        <col width="NaN">
                                        <col width="NaN">
                                        <col width="NaN">
                                        <col width="240">
                                    </colgroup>
                                    <thead>
                                        <tr>
                                            <th class="table1_hidden">
                                                <div class="checkbox-item">
                                                    <label>
                                                        <input type="checkbox" name="1" />
                                                    </label>
                                                </div>
                                            </th>
                                            <th class="table1_hidden table1_center">#</th>
                                            <th>角色名称</th>
                                            <th>所属租户</th>
                                            <th>角色别名</th>
                                            <th>角色排序</th>
                                            <th class="table1_hidden table1_center">操作</th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                            <div class="table1-body table-6">
                                <table>
                                    <colgroup>
                                        <col width="50">
                                        <col width="50">
                                        <col width="NaN">
                                        <col width="NaN">
                                        <col width="NaN">
                                        <col width="NaN">
                                        <col width="240">
                                    </colgroup>
                                    <tbody id="table"></tbody>
                                </table>
                            </div>
                            <div class="table1-left_fixed" style="width: 100px;">
                                <div class="table1-head_fixed table-6">
                                    <table>
                                        <colgroup>
                                            <col width="50">
                                            <col width="50">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="240">
                                        </colgroup>
                                        <thead>
                                            <tr>
                                                <th>
                                                    <div class="checkbox-item">
                                                        <label>
                                                            <input type="checkbox" name="allCheckbox" onclick="selectAll()"/>
                                                        </label>
                                                    </div>
                                                </th>
                                                <th class="table1_center">#</th>
                                                <th class="table1_hidden">角色名称</th>
                                                <th class="table1_hidden">所属租户</th>
                                                <th class="table1_hidden">角色别名</th>
                                                <th class="table1_hidden">角色排序</th>
                                                <th class="table1_hidden table1_center">操作</th>
                                            </tr>
                                        </thead>
                                    </table>
                                </div>
                                <div class="table1-body_fixed table-6">
                                    <table>
                                        <colgroup>
                                            <col width="50">
                                            <col width="50">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="240">
                                        </colgroup>
                                        <tbody id="table_left"></tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="table1-right_fixed" style="width: 240px;">
                                <div class="table1-head_fixed table-6">
                                    <table>
                                        <colgroup>
                                            <col width="50">
                                            <col width="50">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="240">
                                        </colgroup>
                                        <thead>
                                            <tr>
                                                <th class="table1_hidden">
                                                    <div class="checkbox-item">
                                                        <label>
                                                            <input type="checkbox" name="1" />
                                                        </label>
                                                    </div>
                                                </th>
                                                <th class="table1_center table1_hidden">>#</th>
                                                <th class="table1_hidden">角色名称</th>
                                                <th class="table1_hidden">所属租户</th>
                                                <th class="table1_hidden">角色别名</th>
                                                <th class="table1_hidden">角色排序</th>
                                                <th class="table1_center">操作</th>
                                            </tr>
                                        </thead>
                                    </table>
                                </div>
                                <div class="table1-body_fixed table-6">
                                    <table>
                                        <colgroup>
                                            <col width="50">
                                            <col width="50">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="NaN">
                                            <col width="240">
                                        </colgroup>
                                        <tbody id="table_right"></tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 角色-新增 -->
                <div class="m-pop" id="pop-juesexinzeng">
                    <div class="win-pop4">
                        <div class="win1-hd">
                            <div class="win1-btn">
                                <a href="javascript:;" class="fullscreen js-fullscreen">
                                    <i class="el-icon-full-screen"></i>
                                </a>
                                <a href="javascript:;" class="close js-close">
                                    <i class="el-icon-close"></i>
                                </a>
                            </div>
                            <h3>新 增</h3>
                        </div>
                        <div class="win3-bd">
                            <div class="form-1 form-5">
                                <form action="">
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色名称:</div>
                                        <div class="con">
                                            <input id="roleName_add" type="text" class="input-inner" placeholder="请输入角色名称" value="">
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色别名:</div>
                                        <div class="con">
                                            <input id="roleAlias_add" type="text" class="input-inner" placeholder="请输入角色别名" value="">
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色排序:</div>
                                        <div class="con">
                                            <div class="asc">
                                                <i class="el-icon-arrow-up"></i>
                                            </div>
                                            <div class="desc">
                                                <i class="el-icon-arrow-down"></i>
                                            </div>
                                            <input id="sort_add" type="text" class="input-inner" placeholder="" value="">
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="win-bt2">
                            <a href="javascript:;" class="primary-btn" onclick="submitForm('add')"><span><i
                                        class="icon_dn el-icon-circle-close"></i>保存</span></a>
                            <a href="javascript:;" class="js-btn"><span><i
                                        class="icon_dn el-icon-circle-plus-outline"></i>取消</span></a>
                        </div>
                    </div>
                </div>
                <!-- 角色-新增 end -->
                <!-- 角色-查看 -->
                <div class="m-pop" id="pop-juesechakan">
                    <div class="win-pop4">
                        <div class="win1-hd">
                            <div class="win1-btn">
                                <a href="javascript:;" class="fullscreen js-fullscreen">
                                    <i class="el-icon-full-screen"></i>
                                </a>
                                <a href="javascript:;" class="close js-close">
                                    <i class="el-icon-close"></i>
                                </a>
                            </div>
                            <h3>查 看</h3>
                        </div>
                        <div class="win3-bd">
                            <div class="form-1 form-5">
                                <form action="">
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色名称:</div>
                                        <div class="con">
                                            <input id="roleName_view" type="text" class="input-inner" placeholder="" disabled>
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>所属租户:</div>
                                        <div class="con">
                                            <div class="dropmenurel01 doneTit dropmenurel01_disabled js-dropmenu"
                                                data-modulename="dropmenurel01">
                                                <input type="hidden" value="0">
                                                <div class="dropmenurel01-tit">
                                                    <span id="tenantId_view"></span>
                                                    <i class="el-input__icon el-icon-arrow-up"></i>
                                                </div>
                                                <div class="dropmenurel01-options js-dropmenu-options">
                                                    <i class="popper__arrow"></i>
                                                    <ul>
                                                        <div class="input">
                                                            <input type="text" class="input-inner"
                                                                placeholder="输入关键字进行过滤">
                                                        </div>
                                                        <div class="tree-ul js_tree js-custom-radio-checkbox"
                                                            data-modulename="formrel01">
                                                            <ul>
                                                                <li>
                                                                    <div class="title">
                                                                        <i
                                                                            class="el-icon-caret-right icon-calendar"></i>
                                                                        <span class="name">1</span>
                                                                    </div>
                                                                </li>
                                                            </ul>
                                                        </div>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色别名:</div>
                                        <div class="con">
                                            <input id="roleAlias_view" type="text" class="input-inner" placeholder="" disabled>
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色排序:</div>
                                        <div class="con">
                                            <div class="asc">
                                                <i class="el-icon-arrow-up"></i>
                                            </div>
                                            <div class="desc">
                                                <i class="el-icon-arrow-down"></i>
                                            </div>
                                            <input id="sort_view" type="text" class="input-inner" placeholder="" disabled>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 角色-查看 end -->
                <!-- 角色-编辑 -->
                <div class="m-pop" id="pop-juesebianji">
                    <div class="win-pop4">
                        <div class="win1-hd">
                            <div class="win1-btn">
                                <a href="javascript:;" class="fullscreen js-fullscreen">
                                    <i class="el-icon-full-screen"></i>
                                </a>
                                <a href="javascript:;" class="close js-close">
                                    <i class="el-icon-close"></i>
                                </a>
                            </div>
                            <h3>新 增</h3>
                        </div>
                        <div class="win3-bd">
                            <div class="form-1 form-5">
                                <form action="">
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色名称:</div>
                                        <div class="con">
                                            <input id="roleName_edit" type="text" class="input-inner" placeholder="请输入角色名称" value="">
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色别名:</div>
                                        <div class="con">
                                            <input id="roleAlias_edit" type="text" class="input-inner" placeholder="请输入角色别名" value="">
                                        </div>
                                    </div>
                                    <div class="form-item col-1">
                                        <div class="tit"><span>*</span>角色排序:</div>
                                        <div class="con">
                                            <div class="asc">
                                                <i class="el-icon-arrow-up"></i>
                                            </div>
                                            <div class="desc">
                                                <i class="el-icon-arrow-down"></i>
                                            </div>
                                            <input id="sort_edit" type="text" class="input-inner" placeholder="" value="">
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="win-bt2">
                            <a href="javascript:;" class="primary-btn" onclick="submitForm('edit')"><span><i
                                        class="el-icon-circle-check"></i>修改</span></a>
                            <a href="javascript:;" class="js-btn"><span><i
                                        class="el-icon-circle-close"></i>取消</span></a>
                        </div>
                    </div>
                </div>
                <!-- 角色-编辑 end -->
                <!-- 权限设置 -->
                <div class="m-pop" id="pop-quanxianshezhi">
                    <div class="win-pop7">
                        <div class="win1-hd">
                            <div class="win1-btn">
                                <a href="javascript:;" class="close js-close">
                                    <i class="el-icon-close"></i>
                                </a>
                            </div>
                            <h3>角色权限配置</h3>
                        </div>
                        <div class="win3-bd">
                            <div class="tabrel04 js-tabs js-anim" data-modulename="tabrel04">
                                <ul class="tabrel04-tit">
                                    <li class="tabrel04-item tabrel04-item__on"><span class="subitem">菜单权限</span></li>
                                    <li class="tabrel04-item"><span class="subitem">数据权限</span></li>
                                    <li class="tabrel04-item"><span class="subitem">接口权限</span></li>
                                </ul>
                                <div class="tabrel04-desc">
                                    <div class="tabrel04-item tabrel04-item__on">
                                        <div class="tree-ul js_tree js-custom-radio-checkbox"
                                            data-modulename="formrel01">
                                            <ul id="menuScope"></ul>
                                        </div>
                                    </div>
                                    <div class="tabrel04-item">
                                        <div class="tree-ul js_tree js-custom-radio-checkbox"
                                        data-modulename="formrel01">
                                            <ul id="dataScope"></ul>
                                        </div>
                                    </div>
                                    <div class="tabrel04-item">
                                        <div class="tree-ul js_tree js-custom-radio-checkbox"
                                            data-modulename="formrel01">
                                            <ul id="apiScope"></ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="win-bt2">
                            <a href="javascript:;" class="js-btn"><span>取消</span></a>
                            <a href="javascript:;" class="primary-btn" onclick="sumbitPermission()"><span>确定</span></a>
                        </div>
                    </div>
                </div>
                <!-- 权限设置 end -->
                <!-- 主内容 end -->
            </div>
        </div>
        <!-- 布局-主内容 end -->
    </div>
    <div class="pop-bg"></div>
    <!-- 合约禁用弹窗 -->
    <div class="m-pop" id="pop-heyuejinyong">
        <div class="win-pop1">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>合约禁用</h3>
            </div>
            <div class="win1-bd">
                <div class="win1-item">
                    <div class="tit">禁用原因<span>*</span></div>
                    <div class="con">
                        <input type="text" class="input-inner" />
                    </div>
                </div>
            </div>
            <div class="win-bt">
                <a href="javascript:;" class="js-btn"><span>取 消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确 定</span></a>
            </div>
        </div>
    </div>
    <!-- 合约禁用弹窗 end -->
    <!-- 撤销弹窗 -->
    <div class="m-pop" id="pop-chexiaozhengshu">
        <div class="win-pop1">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>撤销</h3>
            </div>
            <div class="win1-bd">
                <div class="win1-item">
                    <div class="tit">撤销原因:</div>
                    <div class="con">
                        <textarea class="textarea-inner" placeholder="请输入撤销原因"></textarea>
                    </div>
                </div>
            </div>
            <div class="win-bt">
                <a href="javascript:;" class="primary-btn"><span>提交</span></a>
                <a href="javascript:;" class="js-btn"><span>返回</span></a>
            </div>
        </div>
    </div>
    <!-- 撤销弹窗 end -->
    <!-- 禁用弹窗 -->
    <div class="m-pop" id="pop-jinyong">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-info"></div>
                    <div class="desc">
                        <p>您确定要禁用标识吗？</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 禁用弹窗 end -->
    <!-- 启用弹窗 -->
    <div class="m-pop" id="pop-qiyong">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-info"></div>
                    <div class="desc">
                        <p>您确定要启用标识吗？</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 启用弹窗 end -->
    <!-- 下载KeyStore -->
    <div class="m-pop" id="pop-xiazaiKeyStore">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="tit">请输入创建人的私钥</div>
                    <div class="con">
                        <input type="text" class="input-inner" />
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 下载KeyStore end -->
    <!-- 删除 -->
    <div class="m-pop" id="pop-shanchu">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-warning"></div>
                    <div class="desc">
                        <p>此操作将永久删除该数据, 是否继续?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 删除 end -->
    <!-- 删除2 -->
    <div class="m-pop" id="pop-shanchu2">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-info"></div>
                    <div class="desc">
                        <p>确定删除选中角色?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 删除2 end -->
    <!-- 删除3 -->
    <div class="m-pop" id="pop-shanchu3">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <!-- <h3>提示</h3> -->
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-warning"></div>
                    <div class="desc">
                        <p>确定将选择数据删除?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn" onclick="deleteRole('3')"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 删除3 end -->
    <!-- 删除4 -->
    <div class="m-pop" id="pop-shanchu4">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <!-- <h3>提示</h3> -->
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-warning"></div>
                    <div class="desc">
                        <p>确定将选择数据删除?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn" onclick="deleteRole('4')"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 删除4 end -->
    <!-- 移至黑名单 -->
    <div class="m-pop" id="pop-yizhiheimingdan">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-warning"></div>
                    <div class="desc">
                        <p>确定将该用户移至黑名单吗?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 移至黑名单 end -->
    <!-- 升至管理员 -->
    <div class="m-pop" id="pop-shengzhiguanliyuan">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-warning"></div>
                    <div class="desc">
                        <p>确定将该用户添加至管理员?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 升至管理员 end -->
    <!-- 移除管理员 -->
    <div class="m-pop" id="pop-yichuguanliyuan">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>提示</h3>
            </div>
            <div class="win3-bd">
                <div class="win3-item">
                    <div class="icon_dn el-icon-info"></div>
                    <div class="desc">
                        <p>确定移除该用户管理员?</p>
                    </div>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 移除管理员 end -->
    <!-- 重置密码 -->
    <div class="m-pop" id="pop-chongzhimima">
        <div class="win-pop3">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-icon-close"></i>
                    </a>
                </div>
                <h3>请输入接收密码的邮箱</h3>
            </div>
            <div class="win3-bd">
                <div class="form-1 form-4">
                    <form action="">
                        <div class="form-item col-1">
                            <div class="tit"></div>
                            <div class="con">
                                <input type="text" class="input-inner" placeholder="">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="win-bt2">
                <a href="javascript:;" class="js-btn"><span>取消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确定</span></a>
            </div>
        </div>
    </div>
    <!-- 重置密码 end -->
    <!-- 钱包解锁弹窗 -->
    <div class="m-pop" id="pop-qianbaojiesuo">
        <div class="win-pop2">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-dialog__close el-icon el-icon-close"></i>
                    </a>
                </div>
                <h3>钱包解锁</h3>
            </div>
            <div class="win1-bd">
                <div class="win2-item">
                    <div class="tit">请选择方式：</div>
                    <div class="con">
                        <ul class="radio-group js-custom-radio-checkbox" data-modulename="formrel01">
                            <li data-selectName=".item-select1">
                                <label>
                                    <input type="radio" name="1" checked />
                                    <i class="icon"></i>
                                    <span>BID keystore 文件</span>
                                </label>
                            </li>
                            <li data-selectName=".item-select2">
                                <label>
                                    <input type="radio" name="1" />
                                    <i class="icon"></i>
                                    <span>BID私钥</span>
                                </label>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="win2-item item-select1">
                    <div class="tit">请选择BID Keystore文件</div>
                    <div class="con">
                        <div class="file-upload_box3">
                            <div class="fileUpload-btn3">
                                <label>
                                    <input type="file" class="js-upload">
                                    <span><i class="icon_dn el-icon-upload e-upload"></i>选择文件</span>
                                </label>
                            </div>
                            <ul class="fileUpload-files">
                                <!-- <li>
                                <a href="javascript:;">
                                    <i class="el-icon-document"></i>
                                    <span>5cd67b13-740e-4f77-b950-09e47e60881d (1).json</span>
                                </a>
                                <i class="el-icon-close"></i>
                            </li> -->
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="win2-item col-1 item-select1">
                    <div class="tit">请输入密码：</div>
                    <div class="con">
                        <div class="input-suffix">
                            <input type="password" class="input-inner" placeholder="请输入密码" />
                            <div class="icon">
                                <i class="el-input__icon i-changetype el-icon-view"></i>
                                <i class="el-input__icon el-icon-circle-close"></i>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="win2-item col-1 item-select2">
                    <div class="tit">请输入BID私钥：</div>
                    <div class="con">
                        <div class="input-suffix">
                            <input type="password" class="input-inner" placeholder="请输入BID私钥" />
                            <div class="icon">
                                <i class="el-input__icon i-changetype el-icon-view"></i>
                                <i class="el-input__icon el-icon-circle-close"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="win-bt win-bt_center">
                <a href="javascript:;" class="js-btn"><span>取 消</span></a>
                <a href="javascript:;" class="primary-btn"><span>确 定</span></a>
            </div>
        </div>
    </div>
    <!-- 钱包解锁弹窗 end -->
    <!-- 显隐 -->
    <div class="m-pop" id="pop-xianyin">
        <div class="win-pop5">
            <div class="win1-hd">
                <div class="win1-btn">
                    <a href="javascript:;" class="close js-close">
                        <i class="el-dialog__close el-icon el-icon-close"></i>
                    </a>
                </div>
                <h3>多 选</h3>
            </div>
            <div class="win1-bd">
                <ul class="checkbox-group2 js-custom-radio-checkbox" data-modulename="formrel01">
                    <li>
                        <label>
                            <input type="checkbox" name="1" checked />
                            <i class="icon"></i>
                            <span>角色名称</span>
                        </label>
                    </li>
                    <li>
                        <label>
                            <input type="checkbox" name="1" />
                            <i class="icon"></i>
                            <span>所属租户</span>
                        </label>
                    </li>
                    <li>
                        <label>
                            <input type="checkbox" name="1" />
                            <i class="icon"></i>
                            <span>角色别名</span>
                        </label>
                    </li>
                    <li>
                        <label>
                            <input type="checkbox" name="1" />
                            <i class="icon"></i>
                            <span>角色排序</span>
                        </label>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!-- 显隐 end -->
    <script src="/js/module.js"></script>
    <script>

        var currentPage = 1;
        var currentSize = 10;

        var selectList = {};
        var tableData = [];
        // 需要删除的数据
        var removeList=[];
        // 编辑的数据
        var editObj={};
        // 是否选择全部
        var isSelectedAll = false;

        // 服务组
        var selectgroup = function () {
            $request({
                url: '/bmsApi/blade-system/tenant/select',
            }, function (res) {
                var template = '';
                $.each(res, function(i, x){
                    template += "<li onclick='selectChange(" + x.tenantId + ")' data-value='" + x.tenantId + "'>" + x.tenantName + "</li>"
                });
                $('#select').append(template);
                $.each(res, function(i, x){
                    selectList[x.tenantId] = x.tenantName;
                })
                getData();
            });
        };
        //
        function selectChange(tenantId) {
            console.log("tenantId",tenantId)
        }
        // 展开或者收起
        function switchTree(e){
            var display=$(e).parent().next().children().css('display')
            if(display==='list-item'){
                $(e).parent().next().children().css('display','none')
                $(e).css("transform",'rotate(0deg)')
            }else{
                $(e).parent().next().children().css('display','list-item')
                $(e).css("transform",'rotate(90deg)')
            }
        }
        // 角色权限配置操作树
        function selectChecbox(e){
            if($(e).attr("checked")){
                $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
            }else{
                $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
            }
        }

        // 刷新
        $('#refresh').click(function(){
            getData()
        })
        // 搜索
        $('#search').click(function () {
            currentPage = 1;
            getData()
        })
        // 清空
        $('#reset').click(function () {
            $('#role').val('');
            $('#roleAlias').val('');
            $('#tenantId').val('');
            $('#tenantName').html('所属租户');
            currentPage = 1;
            getData();
        })
        // 权限设置按钮
        $("#permission_set").click(function(){
            var selecteds=[]
            $("input[name='checkbox']:checked").each(function (index, item) {
                console.log("item",$(item).val())
                selecteds.push($(item).val());
            });
            if(selecteds.length===1){
                $('#pop-quanxianshezhi').fadeIn("normal");
                $('.pop-bg').addClass('open');
                getGrantTree();
            }else if(selecteds.length===0){
                alert("至少选择一条数据");
            }else if(selecteds.length>1){
                alert("只能选择一条数据");
            }
        })
        // 批量删除
        $("#batch_delete").click(function(e){
            removeList=[]
            $("input[name='checkbox']:checked").each(function (index, item) {
                removeList.push($(item).val());
            });
        })
        // 查看按钮
        function view(index,e){
            var _id = $(e).attr('data-href');
            $(_id).fadeIn("normal");
            $('.pop-bg').addClass('open');
            var detail = tableData[Number(index)]
            $('#roleName_view').val(detail.roleName)
            $('#tenantId_view').html(selectList[detail.tenantId])
            $('#roleAlias_view').val(detail.roleAlias)
            $('#sort_view').val(detail.sort)
        }
        // 编辑按钮
        function edit(index,e){
            var detail = tableData[Number(index)]
            if(detail.roleName == "系统管理员"){
                alert("系统角色不能修改");
                return;
            }
            var _id = $(e).attr('data-href');
            $(_id).fadeIn("normal");
            $('.pop-bg').addClass('open');
            $('#roleName_edit').val(detail.roleName)
            $('#roleAlias_edit').val(detail.roleAlias)
            $('#sort_edit').val(detail.sort)
            editObj = detail
        }
        // 删除按钮
        function deleteBtn(index,e){
            var detail = tableData[Number(index)]
            if(detail.roleName == "系统管理员"){
                alert("系统角色不能修改");
                return;
            }
            var _id = $(e).attr('data-href');
            $(_id).fadeIn("normal");
            $('.pop-bg').addClass('open');
            var id=tableData[Number(index)].id
            removeList=[id]
        }
        // 选择全部
        function selectAll(){
            if(isSelectedAll){
                $("input[name='checkbox']").each(function(i,item){
                    item.checked = false
                })
                isSelectedAll = false
            }else{
                $("input[name='checkbox']").each(function(i,item){
                    item.checked = true
                })
                isSelectedAll = true
            }
        }
        // 行checkbox选择
        function selectCheckBox(e){
            if($(e).attr("checked")){
                $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
            }else{
                $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
            }
        }
        // 表格
        var getData = function () {
            var roleName = $('#role').val();
            var roleAlias = $('#roleAlias').val();
            var tenantId = $('#tenantId').val();
            $request({
                url: '/bmsApi/blade-system/role/list?current=' + currentPage + '&size=' + currentSize,
                data: {
                    roleName: roleName,
                    roleAlias: roleAlias,
                    tenantId: tenantId
                }
            }, function (res) {
                tableData = res;
                var template = '';
                var templateLeft="";
                var templateRight="";
                $('#table').children().remove();
                $('#table_left').children().remove();
                $('#table_right').children().remove();
                $.each(tableData, function(i, x){
                    template += "<tr>" +
                        "<td class='table1_hidden'>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='checkbox'/>" +
                        "</label>" +
                        "</div>" +
                        "</td>" +
                        "<td class='table1_center table1_hidden'>" + (i + 1) + "</td>" +
                        "<td>" + x.roleName + "</td>" +
                        "<td>" + selectList[x.tenantId] + "</td>" +
                        "<td>" + x.roleAlias + "</td>" +
                        "<td>" + x.sort + "</td>" +
                        "<td class='table1_hidden table1_center'>" +
                        "<div class='table1-btn'>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-juesechakan'><i class='icon_dn el-icon-view'></i>查看</a>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-juesebianji'><i class='icon_dn el-icon-edit'></i>编辑</a>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-shanchu4'><i class='icon_dn el-icon-delete'></i>删除</a>" +
                        "</div>" +
                        "</td>" +
                        "</tr>";
                    templateLeft += "<tr>" +
                        "<td>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='checkbox' value="+x.id+" onclick='selectCheckBox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "</td>" +
                        "<td class='table1_center'>" + (i + 1) + "</td>" +
                        "<td class='table1_hidden'>" + x.roleName + "</td>" +
                        "<td class='table1_hidden'>" + selectList[x.tenantId] + "</td>" +
                        "<td class='table1_hidden'>" + x.roleAlias + "</td>" +
                        "<td class='table1_hidden'>" + x.sort + "</td>" +
                        "<td class='table1_hidden table1_center'>" +
                        "<div class='table1-btn'>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-juesechakan'><i class='icon_dn el-icon-view'></i>查看</a>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-juesebianji'><i class='icon_dn el-icon-edit'></i>编辑</a>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-shanchu4'><i class='icon_dn el-icon-delete'></i>删除</a>" +
                        "</div>" +
                        "</td>" +
                        "</tr>"
                    templateRight += "<tr>" +
                        "<td class='table1_hidden'>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='checkbox' />" +
                        "</label>" +
                        "</div>" +
                        "</td>" +
                        "<td class='table1_center table1_hidden'>" + (i + 1) + "</td>" +
                        "<td class='table1_hidden'>" + x.roleName + "</td>" +
                        "<td class='table1_hidden'>" + selectList[x.tenantId] + "</td>" +
                        "<td class='table1_hidden'>" + x.roleAlias + "</td>" +
                        "<td class='table1_hidden'>" + x.sort + "</td>" +
                        "<td>" +
                        "<div class='table1-btn'>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-juesechakan' onclick='view("+i+",this)'><i class='icon_dn el-icon-view'></i>查看</a>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-juesebianji' onclick='edit("+i+",this)'><i class='icon_dn el-icon-edit'></i>编辑</a>" +
                        "<a href='javascript:;' class='myfancy' data-href='#pop-shanchu4' onclick='deleteBtn("+i+",this)'><i class='icon_dn el-icon-delete'></i>删除</a>" +
                        "</div>" +
                        "</td>" +
                        "</tr>";
                    
                });
                $('#table').append(template);
                $('#table_left').append(templateLeft);
                $('#table_right').append(templateRight);
            })
        }
        // 新增/修改
        function submitForm(type){
            var roleName = $("#roleName_"+type).val();
            var roleAlias = $("#roleAlias_"+type).val();
            var sort = $("#sort_"+type).val();
            editObj.roleName = roleName;
            editObj.roleAlias = roleAlias;
            editObj.sort = sort;
            $request({
                url: '/bmsApi/blade-system/role/submit',
                method: 'post',
                data:JSON.stringify(editObj),
            },function(e){
                editObj = {};
                $("#roleName_"+type).val('');
                $("#roleAlias_"+type).val('');
                $("#sort_"+type).val('');
                if(type==="edit"){
                    $("#pop-juesebianji").fadeOut("normal");
                }else{
                    $("#pop-juesexinzeng").fadeOut("normal");
                }
                $('.pop-bg').removeClass('open');
                getData();
            })
        }
        // 删除角色
        function deleteRole(num){
            var ids = removeList.join()
            console.log("ids",ids)
            $request({
                url: '/bmsApi/blade-system/role/remove',
                method: 'post',
                data: {
                    ids: ids
                },
                contentType: 'application/x-www-form-urlencoded'
            },function(e){
                $("#pop-shanchu"+num).fadeOut("normal");
                $('.pop-bg').removeClass('open');
                getData()
            })
        }
        // 权限分配树
        function getGrantTree(){
            $request({
                url: '/bmsApi/blade-system/menu/grant-tree',
                method: 'get',
            }, function(res) {
                $("input[name='checkbox']:checked").each(function (index, item) {
                    getRoleTree($(item).val());
                });
                var menuTemplate = ''
                var dataTemplate = ''
                var apiTemplate = ''
                if(res.menu.length){
                    $.each(res.menu, function(i, x){
                        menuTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='menucheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                        if(x.hasChildren){
                            menuTemplate = renderChildren(x.children,menuTemplate,'menu')
                        }
                        menuTemplate += "</li>";
                    })
                }else{
                    menuTemplate += "<div class='none-data'>" + 
                        "<p>暂无数据</p>" +
                    "</div>"
                }
                if(res.dataScope.length){
                    $.each(res.dataScope, function(i, x){
                        dataTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='datacheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                        if(x.hasChildren){
                            dataTemplate = renderChildren(x.children,dataTemplate,'data')
                        }
                        dataTemplate += "</li>";
                    })
                }else{
                    dataTemplate += "<div class='none-data'>" + 
                        "<p>暂无数据</p>" +
                    "</div>"
                }
                if(res.apiScope.length){
                    $.each(res.apiScope, function(i, x){
                        apiTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='apicheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                        if(x.hasChildren){
                            apiTemplate = renderChildren(x.children,apiTemplate,'api')
                        }
                        apiTemplate += "</li>";
                    })
                }else{
                    apiTemplate += "<div class='none-data'>" + 
                        "<p>暂无数据</p>" +
                    "</div>"
                }
                console.log(menuTemplate)
                $('#menuScope').children().remove();
                $('#dataScope').children().remove();
                $('#apiScope').children().remove();
                $('#menuScope').append(menuTemplate)
                $('#dataScope').append(dataTemplate)
                $('#apiScope').append(apiTemplate)
            })
        }
        // 渲染子元素
        function renderChildren(children,template,type){
            template += "<ul>";
            $.each(children, function(i, item){
                template += "<li>" +
                    "<div class='title'>" +
                    "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(item.hasChildren?' icon-plus-sign':'')+"'></i>" +
                    "<div class='checkbox-item'>" +
                    "<label>" +
                    "<input type='checkbox' name='"+type+"checkbox' value="+item.id+" onclick='selectChecbox(this)'/>" +
                    "</label>" +
                    "</div>" +
                    "<span class='name'>"+item.title+"</span>" +
                    "</div>";
                    
                    if(item.hasChildren){
                        template=renderChildren(item.children,template,type)
                    }
                    template += "</li>";
            })
            template += "</ul>";
            return template
        }
         // 角色所分配的树
         function getRoleTree(roleIds){
            $request({
                url: '/bmsApi/blade-system/menu/role-tree-keys?roleIds='+roleIds,
                method: 'get',
            }, function(res) {
                var apiScope=res.apiScope;
                var dataScope=res.dataScope;
                var menu=res.menu;
                $.each(apiScope, function(i, item){
                    $("input[name='apicheckbox'][value="+item+"]").attr("checked",true);
                    $("input[name='apicheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
                })
                $.each(dataScope, function(i, item){
                    $("input[name='datacheckbox'][value="+item+"]").attr("checked",true);
                    $("input[name='datacheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
                })
                $.each(menu, function(i, item){
                    $("input[name='menucheckbox'][value="+item+"]").attr("checked",true);
                    $("input[name='menucheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
                })
            })
        }
        // 提交权限设置
        function sumbitPermission(){
            var apiScopeIds=[];
            var dataScopeIds=[];
            var menuIds =[];
            var roleIds=[];
            $("input[name='apicheckbox']:checked").each(function (index, item) {
                apiScopeIds.push($(item).val());
            });
            $("input[name='datacheckbox']:checked").each(function (index, item) {
                dataScopeIds.push($(item).val());
            });
            $("input[name='menucheckbox']:checked").each(function (index, item) {
                menuIds.push($(item).val());
            });
            $("input[name='checkbox']:checked").each(function (index, item) {
                roleIds.push($(item).val());
            });
            var params={
                apiScopeIds: apiScopeIds,
                dataScopeIds: dataScopeIds,
                menuIds: menuIds,
                roleIds: roleIds
            }
            $request({
                url: '/bmsApi/blade-system/role/grant',
                method: 'post',
                data:JSON.stringify(params),
            },function(e){
                $('#pop-quanxianshezhi').fadeOut("normal");
                $('.pop-bg').removeClass('open');
                getData()
            })
        
        }
        
        // 初始化页面请求
        selectgroup();

    </script>
</body>

</html>